#include<iostream>
#include<unordered_map>
#include<vector>
using namespace std;

class Solution {
public:
	vector<int> twoSum(vector<int>& nums, int target) {
		unordered_map<int, int> hashtable;
		for (int i = 0; i < nums.size(); ++i) {
			auto it = hashtable.find(target - nums[i]);
			if (it != hashtable.end()) {
				return { it->second, i };
			}
			hashtable[nums[i]] = i;
		}
		return {};
	}

};

int main() {
	int arr[] = { 1,1,6,8,9 };
	vector<int> varr(arr,arr+5);
	Solution s;
	s.twoSum(varr, 2);
	return 0;
}